package com.cloudcc.mobile.dao.impl;

import java.util.List;

import org.json.JSONObject;

import com.cloudcc.cloudframe.net.ResultCallBack;
import com.cloudcc.cloudframe.net.async.BeanRequest;
import com.cloudcc.mobile.dao.BaseEngine;
import com.cloudcc.mobile.entity.MultipleListmodel;
import com.cloudcc.mobile.entity.approval.ApprovalModel;
import com.cloudcc.mobile.entity.approval.TaskApprovalHistoryModel;
import com.cloudcc.mobile.entity.approval.TaskManagementModel;
import com.google.gson.JsonObject;
import com.loopj.android.http.RequestParams;
/**
 * 
 * @author lhy
 *审批部分
 */
public class ApprovalEngineImpl extends BaseEngine{
	//审批历史列表
	public void getApprovalHistoryList(JsonObject json, ResultCallBack<List<ApprovalModel>> listener) {
		BeanRequest<List<ApprovalModel>> request = new BeanRequest<List<ApprovalModel>>(){};
		request.setResultListener(listener);
		sendPost(json.toString(), request, "getApprovalHistory", true);
	}
	//调回批准请求
	public void ApprovalRebackRequest(JSONObject json, ResultCallBack<Object> listener){
		BeanRequest<Object> request = new BeanRequest<Object>(){};
		request.setResultListener(listener);
		sendPost(json, request, "getChatterUserInfo", true);
	}
	//重新分配
	public void ApprovalAgainRequest(JSONObject json, ResultCallBack<Object> listener){
		BeanRequest<Object> request = new BeanRequest<Object>(){};
		request.setResultListener(listener);
		sendPost(json, request, "getChatterUserInfo", true);
	}
		//进行审批
	public void ApprovalGoingApprovalRequest(JSONObject json, ResultCallBack<Object> listener){
		BeanRequest<Object> request = new BeanRequest<Object>(){};
		request.setResultListener(listener);
		sendPost(json, request, "getChatterUserInfo", true);
	}
	
	//小列表
		public void GetMultipleRequest(JsonObject json, ResultCallBack<MultipleListmodel> resultCallBack){
			BeanRequest<MultipleListmodel> request = new BeanRequest<MultipleListmodel>(){};
			request.setResultListener(resultCallBack);
			sendPost(json, request, "getRelationDataByRelationId", true);
		}
		public void GetManagementTask(JSONObject json, ResultCallBack<List<TaskManagementModel>> resultCallBack){
			BeanRequest<List<TaskManagementModel>> request = new BeanRequest<List<TaskManagementModel>>(){};
			request.setResultListener(resultCallBack);
			sendPost(json, request, "getRelationDataByRelationId", true);
		}
		//审批列表
		public void GetManagementTask(String userId, ResultCallBack<List<TaskManagementModel>> resultCallBack){
			BeanRequest<List<TaskManagementModel>> request = new BeanRequest<List<TaskManagementModel>>(){};
			request.setResultListener(resultCallBack);
			RequestParams params = new RequestParams();
			params.put("userId", userId);
			sendPost(params, "getApprovalPaddingList", request);
		}
		//审批状态列表getApprovalHistory
		public void getApprovalHistory(String relatedId, ResultCallBack<List<TaskApprovalHistoryModel>> resultCallBack){
			BeanRequest<List<TaskApprovalHistoryModel>> request = new BeanRequest<List<TaskApprovalHistoryModel>>(){};
			request.setResultListener(resultCallBack);
			RequestParams params = new RequestParams();
			params.put("relatedId", relatedId);
			sendPost(params, "getApprovalHistory", request);
		}
		
}
